Hello All, Is there a way to read a file via http protocol? Neither Stream input = read fileURL nor readFile(fileURL) worked.
GaborMoizes - Mon Jan 27 10:43:26 EST 2014 |
Re: Read from http Wow, that is funny. I was just about to post a question as to "How to determine if a "http" file exists. Which would be the next logical question that would be asked once you have been able to read an "http" file. I'm following this thread. |
Re: Read from http Well there should be a way to do it natively with DOORS using the html edit control. There is an example in the help. If you do not want to use a GUI you can use the COM API and Microsofts extensive libraries, that should allow you to do what you need. Do you need to load a binary file or a text file? With binaries you will have trouble regarding null bytes in Files which DXL does not support well. A quick example for the MSXML control (see MSDN for details):
string loadPage (string URL, string Method) {
string sErr
OleAutoObj html = oleCreateAutoObject "MSXML2.ServerXMLHTTP";
OleAutoArgs args = create()
put(args, Method)
put(args, URL)
put(args, false)
sErr = oleMethod(html, "open", args)
if (!null sErr) return sErr
clear(args)
put (args, "")
sErr = oleMethod(html, "send", args)
if (!null sErr) return sErr
string sResult = ""
sErr = oleGet(html, "responseText", sResult)
if (!null sErr) return sErr
oleCloseAutoObject html
delete args
return sResult
}
print loadPage("http://www.google.de/", "GET")
Hope this helps, regards, Mathias |
Re: Read from http Mathias Mamsch - Wed Jan 29 04:11:26 EST 2014 Well there should be a way to do it natively with DOORS using the html edit control. There is an example in the help. If you do not want to use a GUI you can use the COM API and Microsofts extensive libraries, that should allow you to do what you need. Do you need to load a binary file or a text file? With binaries you will have trouble regarding null bytes in Files which DXL does not support well. A quick example for the MSXML control (see MSDN for details):
string loadPage (string URL, string Method) {
string sErr
OleAutoObj html = oleCreateAutoObject "MSXML2.ServerXMLHTTP";
OleAutoArgs args = create()
put(args, Method)
put(args, URL)
put(args, false)
sErr = oleMethod(html, "open", args)
if (!null sErr) return sErr
clear(args)
put (args, "")
sErr = oleMethod(html, "send", args)
if (!null sErr) return sErr
string sResult = ""
sErr = oleGet(html, "responseText", sResult)
if (!null sErr) return sErr
oleCloseAutoObject html
delete args
return sResult
}
print loadPage("http://www.google.de/", "GET")
Hope this helps, regards, Mathias Hi Mathias, Thanks for the reply. Sorry for my ignorance but can you tell me how you are creating the control that contains your code above. I like it !!! |
Re: Read from http Doug.Zawacki - Wed Jan 29 10:51:44 EST 2014 Hi Mathias, Thanks for the reply. Sorry for my ignorance but can you tell me how you are creating the control that contains your code above. I like it !!! When you edit your post press the button that looks like "<>" which has a popover help that says "Add Code". Regards, Mathias |
Re: Read from http Mathias Mamsch - Wed Jan 29 18:41:20 EST 2014 When you edit your post press the button that looks like "<>" which has a popover help that says "Add Code". Regards, Mathias ...button which does not appear on IE11... |
Re: Read from http Thank you Mathias, worked perfectly. I have to dig deeper into these OLEAutoObjects... |
Re: Read from http adevicq - Thu Jan 30 03:03:10 EST 2014 ...button which does not appear on IE11... Thanks, Apparently, the button does not appear in our version of IE9. Yes, IE9... I can see it in google chrome. |